home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
3565-4.665
/
dmg-4180
/
a
/
a11.doc
< prev
next >
Wrap
Text File
|
1987-04-21
|
1KB
|
68 lines
ROBOTICS
********
By Matthew Green.
*****************
Input/Output Port
-----------------
Part 2
------
Last time I showed you how to light up
each L.E.D on the port. If you have
tried it and have tried changing the
'chr$' number you would have seen some
strange effects.
To turn on each pin you have to change
the number in the brackets, e.g.
CHR$(1) = turn on light one
CHR$(2) = turn on light two
Now you may think that it is going up
in one's but it needs to be doubled
each time you want the next light to
turn on, e.g.
CHR$(4) = turn on light 3
CHR$(8) = turn on light 4
and so on... all the way up to (128)
for light 8.
You may be wondering what the numbers
in between do. Well, I will tell you.
PRINT #1,CHR$(3)
If you did the above line in last
month's program you will see light
number 1 come on and also light number
2 come on. If you can't figure out why
it did this then read the next line...
You add the CHR$ of each light
together and then print that. If you
printed the number '255' it would turn
all the lights on.
Well that's the end of this short
lesson. Try and see if you can make a
program to turn each light on one after
each other, leaving the ones before on.
I will tell you how to do this in the
next article.
Matthew Green.